home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
NMK
/
Recorders
/
RScrollerVars.m
< prev
next >
Wrap
Text File
|
1995-06-12
|
2KB
|
161 lines
/***** RScrollerVars.m -- ScrollerCover variable holder object implementation
NeXTstep Measurement Kit
by Alex Meyer <ameyer@phoenix.Princeton.EDU>
for computer science senior thesis
24 April 1992 -- created
*****/
#import <stdlib.h>
#import <stdio.h>
#import <string.h>
#import <appkit/Application.h>
#import "RScrollerVars.h"
@implementation RScrollerVars
- init /* should not be used */
{
[self free];
return (nil);
}
- initString:(const char *)str
tag:(int)tg
rect:(const NXRect *)rect
{
int i;
char temp[512];
[super init];
linker = NXGetNamedObject(LINKERNAME,NXApp);
sprintf(temp,"%s|%d|%f|%f|%f|%f",str,tg,
rect->origin.x,rect->origin.y,
rect->size.width,rect->size.height);
key = NXUniqueString(temp);
lastHitTime = 0;
stats.numHits = 0;
stats.numKNOB = 0;
stats.numDECPAGE = 0;
stats.numINCPAGE = 0;
stats.numDECLINE = 0;
stats.numINCLINE = 0;
stats.numKNOBSLOT = 0;
stats.timeIn = 0;
stats.timeBetween = 0;
for (i = 0;i < SCROLLERHIST;++i)
stats.histogram[i] = 0;
[linker connect:self];
return (self);
}
- incHits
{
++stats.numHits;
return (self);
}
- incKNOB
{
++stats.numKNOB;
return (self);
}
- incDECPAGE
{
++stats.numDECPAGE;
return (self);
}
- incINCPAGE
{
++stats.numINCPAGE;
return (self);
}
- incDECLINE
{
++stats.numDECLINE;
return (self);
}
- incINCLINE
{
++stats.numINCLINE;
return (self);
}
- incKNOBSLOT
{
++stats.numKNOBSLOT;
return (self);
}
- timeFrom:(double)time0
to:(double)time1
{
stats.timeIn += time1 - time0;
if (lastHitTime)
stats.timeBetween += time0 - lastHitTime;
lastHitTime = time1;
return (self);
}
- incHist:(int)ind
{
++stats.histogram[ind];
return (self);
}
- (unsigned)type
{
return (TM_SCROLLER);
}
- (NXAtom)key
{
return (key);
}
- (NXAtom)desc
{
return (NXUniqueString("{iiiiiiidd[10i]}"));
}
- (unsigned)statsSize
{
return (sizeof(stats));
}
- (void *)copyOfStats
{
void *cpy;
cpy = malloc(sizeof(stats));
memcpy(cpy,&stats,sizeof(stats));
return (cpy);
}
- copyInStats:(void *)NewStats
{
memcpy(&stats,NewStats,sizeof(stats));
return (self);
}
@end